package com.yuwei.yurpc.fault.retry;

import com.yuwei.yurpc.model.RpcResponse;

/**
 * 重试策略测试
 */
public class RetryStrategyTest {

   static RetryStrategy retryStrategy = new FixedIntervalRetryStrategy();


    public static void doRetry() {
        try {
            RpcResponse rpcResponse = retryStrategy.doRetry(() -> {
                System.out.println("测试重试");
                throw new RuntimeException("模拟重试失败");
            });
            System.out.println(rpcResponse);
        } catch (Exception e) {
            System.out.println("重试多次失败");
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        doRetry();
    }
}
